package com.xian.im.modules.avchat.storage;

import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @program: xian-code
 * @description:
 * @author: liru.xian
 * @create: 2021-01-21 15:45
 **/
@Component
public class MessageStorageHandlerContext {

    private Map<String,MessageStorage> messageStorageMap = new ConcurrentHashMap<>();

    public MessageStorageHandlerContext(List<MessageStorage> messageStorageList){
        for (MessageStorage storage : messageStorageList) {
            messageStorageMap.put(storage.match(),storage);
        }
    }

    public MessageStorage getMessageStorage(String  type){
        return messageStorageMap.get(type);
    }
}
